package tree;

public class Skill {
	
	String desc;
	int[] dmgscale;
	int[] sec = null;
	int[] third = null;
	double[] four = null;
	int[] cool;
	int[] sp;
	int[] ep;
	String[] effects;
	int max;
	int curlv = 0;
	int[] points;
	String name;
	String cast = null;
	
	
	public Skill (String name, String desc, int[] dmgscaling, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.points = points;
		this.name = name;
	}
	public Skill (String name, String desc, int[] dmgscaling, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points, String cast) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.points = points;
		this.name = name;
		this.cast = cast;
	}
	public Skill (String name, String desc, int[] dmgscaling, int[] sec, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.sec = sec;
		this.points = points;
		this.name = name;
	}
	public Skill (String name, String desc, int[] dmgscaling, int[] sec, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points, String cast) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.sec = sec;
		this.points = points;
		this.name = name;
		this.cast = cast;
	}
	public Skill (String name, String desc, int[] dmgscaling, int[] sec, int[] third, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.sec = sec;
		this.third = third;
		this.points = points;
		this.name = name;
	}
	public Skill (String name, String desc, int[] dmgscaling, int[] sec, int[] third, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points, String cast) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.sec = sec;
		this.third = third;
		this.points = points;
		this.name = name;
		this.cast = cast;
	}
	
	public Skill (String name, String desc, int[] dmgscaling, int[] sec, int[] third, int[] cool, int[] sp, int[] ep, String[] effects, int max, int[] points, double[] four) {
		this.desc = desc;
		dmgscale = dmgscaling;
		this.cool = cool;
		this.sp = sp;
		this.ep = ep;
		this.effects = effects;
		this.max = max;
		this.sec = sec;
		this.third = third;
		this.points = points;
		this.name = name;
		this.four = four;
	}
	public int getpoints() {
		return points[curlv];
	}
	public void setcurlv(int lv) {
		if (lv < 0 || lv > max) {
			return;
		} else curlv = lv;
	}
	
	public int getlv() {
		return curlv;
	}
	public int getmax() {
		return max;
	}
	
	public String printlv (int lv) {
		
		String sentence;
		sentence = name + " " + lv + "<br>" + desc;
		if (dmgscale != null) {
			sentence = sentence.replace("111", Integer.toString(dmgscale[lv-1]));
		}
		if (sec != null) {
			sentence = sentence.replace("222", Integer.toString(sec[lv-1]));
		}
		if (third != null) {
			sentence = sentence.replace("333", Integer.toString(third[lv-1]));
		}
		if (four != null) {
			sentence = sentence.replace("444", Double.toString(four[lv-1]));
		}
		if (ep != null) {
			sentence = sentence + "<br>Energy Cost: " + ep[lv-1];
		}
		if (sp != null) {
			sentence = sentence + "<br>Stamina Cost: " + sp[lv-1];
		}
		if (cast != null) {
			sentence = sentence + "<br>Cast Time: " + cast;
		}
		if (cool != null) {
			sentence = sentence + "<br>Cooldown: " + cool[lv-1] + " secs";
		}
		if (effects != null) {
			if (!(effects[lv-1].equals(""))) {
				sentence = sentence + "<br>Additional effects:<br>" + effects[lv-1];
			}
		}
		sentence = sentence + "<br>Needs " + points[lv-1] + "+ points in current tree.";
		return sentence + "<br>";
		
	}
	
	public String popup() {
		if (curlv == 0) {
			return "Next Level:<br>" + printlv(curlv +1);
		} else if (curlv == max) {
			return "Max Level:<br>" + printlv(curlv);
		} else {
			return "Current Level:<br>" + printlv(curlv) + "<br>Next Level:<br>" + printlv(curlv+1);
		}
	}
}
